package com.panghl.controller;

import com.panghl.domain.BaseResponse;
import io.swagger.annotations.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

/**
 * 机具管理API接口类
 */
@Api(value = "机具管理业务接口类", tags = "机具管理", description = "机具管理业务接口类")
@ApiResponses(value = {
        @ApiResponse(code = 200, message = "请求已完成"),
        @ApiResponse(code = 201, message = "资源成功被创建"),
        @ApiResponse(code = 400, message = "请求中有语法问题，或不能满足请求"),
        @ApiResponse(code = 401, message = "未授权客户机访问数据"),
        @ApiResponse(code = 403, message = "服务器接受请求，但是拒绝处理"),
        @ApiResponse(code = 404, message = "服务器找不到给定的资源；文档不存在"),
        @ApiResponse(code = 500, message = "服务器出现异常")}
)
@RestController
@RequestMapping(value = "/api/v1")
public class PublicController {

    private static final Logger _logger = LoggerFactory.getLogger(PublicController.class);

    /**
     * 测试Api接口
     *
     * @return 是否入网
     */
    @ApiOperation(value = "测试Api接口", notes = "测试Api接口描述", produces = "application/json")
    @ApiImplicitParam(name = "testName", value = "测试名", required = true, dataType = "String", paramType = "query", defaultValue = "测试1")
    @RequestMapping(value = "/test", method = RequestMethod.GET)
    public ResponseEntity<BaseResponse> join(/*@RequestHeader(name="Accept",  defaultValue = "application/json", required = false) String accept,
                                 @RequestHeader(name="Authorization", defaultValue="token") String token,*/
                                 @RequestParam("testName") String testName) {
        _logger.info("入网查询接口 start....");
        BaseResponse result = new BaseResponse();
        result.setSuccess(true);
        result.setMsg("已入网并绑定了网点");
        result.setData("data...."+testName);
        return new ResponseEntity<BaseResponse>(result,HttpStatus.OK);
    }







}
